var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("GradientColor"),
    s = cc._decorator,
    c = s.ccclass,
    p = s.property,
    l =
        (s.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.gar = null;
                e.moveList = [];
                e.moveNode = null;
                e.viewNode = null;
                return e;
            }
            e.prototype.closeView = function () {
                this.viewNode.active = !1;
            };
            e.prototype.resetView = function () {
                this.closeView();
                this.gar.startColor.a = 0;
                this.gar.endColor.a = 0;
                this.gar.upView = !0;
            };
            e.prototype.play = function () {
                var t = this;
                this.viewNode.active = !0;
                this.viewNode.zIndex = 2;
                this.playColor(0.5);
                this.playMove(0.5);
                this.scheduleOnce(function () {
                    t.resetView();
                }, 0.5);
            };
            e.prototype.playMove = function (t) {
                this.moveNode.stopAllActions();
                this.moveNode.setPosition(this.moveList[0].position);
                this.moveNode.runAction(
                    cc.bezierTo(t, [
                        cc.v2(this.moveList[0].position),
                        cc.v2(this.moveList[1].position),
                        cc.v2(this.moveList[2].position)
                    ])
                );
            };
            e.prototype.playColor = function (t) {
                var e = this,
                    o = {opa: 0, color1: cc.Color.WHITE, color2: cc.Color.WHITE};
                cc.tween(o)
                    .to(
                        t,
                        {opa: 510},
                        {
                            progress: function (t, a, i, n) {
                                o.color1.a = Math.min(255, o.opa);
                                o.color2.a = Math.max(0, o.opa - 255);
                                e.gar.startColor = o.color1;
                                e.gar.endColor = o.color2;
                                e.gar.upView = !0;
                                return t + (a - t) * n;
                            }
                        }
                    )
                    .call(function () {})
                    .start();
            };
            n([p(r.default)], e.prototype, "gar", void 0);
            n([p([cc.Node])], e.prototype, "moveList", void 0);
            n([p(cc.Node)], e.prototype, "moveNode", void 0);
            n([p(cc.Node)], e.prototype, "viewNode", void 0);
            return n([c], e);
        })(cc.Component));
o.default = l;
